s = input()
n = len(s)
inf = float('inf')
dp = [[True for _ in range(n)] for _ in range(n)]
max_word = ""
for i in range(n - 2, -1, -1):
    for j in range(i, n):
        if s[i] == s[j]:
            dp[i][j] = dp[i + 1][j - 1]
            if j == i + 1:
                dp[i][j] = True
        else:
            dp[i][j] = False
        if dp[i][j] and len(max_word) < j - i + 1:
            max_word = s[i:j + 1]
print(max_word)
